public class Node(){
    public int value;
    public Node left;
    public Node right;

    public Node(int data){
        this.value=data;
    }
}

public void preOrderUnRecur(Node head){
    if(head==null){
        return;
    }

    System.out.println(head.value);
    preOrderUnRecur(head.left);
    preOrderUnRecur(head.right);

}




public void PreOrderUnRecur(Node head){
    if(head!=null){
        Stack<node> stack=new Stack<>();
        stack.add(head);
        while(!stack.isEmpty()){
            head=stack.pop();
            System.out.println(head.value+" ");
            if(head.right!=null){
                stack.push(head.right);
            }
            if(head.left!=null){
                stack.push(head.left);
            }
        }
    }
    System.out.println();
}